<head>
    <meta charset="utf8">
</head>
<?php
// 打开数据库连接
include("../functions/db_conn.php");
session_start();
$SociNo = $_SESSION['SociNo'];  // 社团编号
$JobNo=$_GET["JobNo"];  // 岗编号
// 查询该社团有哪些岗位
$sql="SELECT   *  FROM  StuSoci  WHERE  SociNo='".$SociNo."'";
$Result  =mysql_query($sql);
$n=mysql_num_rows($Result);
// 不同情况，用不同方法处理删除
if($n>0){
    echo "<script>";
    echo "alert(\"无法删除已经有学生选择该社团！\");";
    echo "window.history.go(-1);";
    echo "</script>";
}
else{
    $DeleteJob_SQL="DELETE  FROM  Job  WHERE  JobNo='".$JobNo."'";
    $DeleteJob_Result=mysql_query($DeleteJob_SQL);
    if($DeleteJob_Result){
        echo "<script>";
        // echo "alert(\"删除成功！\");";
        echo "window.history.go(-1);";
        echo "</script>";
    }else{
        echo "<script>";
        // echo "alert(\"删除失败，请重新删除！\");";
        echo "window.history.go(-1);";
        echo "</script>";
    }
}
?>